<!DOCTYPE html>
<html lang="en" ng-app="app" ng-controller="myApp" data-title="15公里以内的经销商">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>{{title}}</title>
    <link rel="stylesheet" href="./static/css/base.css">
    <link rel="stylesheet" href="./static/css/outlet.css">

</head>

<body ng-cloak class="ng-cloak">
<div class="title">
        <span>
            < </span>
    15公里以内的经销商
</div>
<div class="shops">
    <div class="search">
        <input type="text" placeholder="请输入地址" ng-model="city">
        <button ng-click="search()">搜索</button>
    </div>

</div>
<div class="list">
    <div ng-show="shops.length">
        <p ng-repeat="(index,item) in shops track by index" ng-click="wxDepartmentId(item.wxDepartmentId)">
            {{item.name}}</p>

    </div>
    <p ng-hide="shops.length">暂无数据</p>
</div>

<!-- js -->
<script src="./static/js/lib/pxRem.js"></script>
<script src="static/js/lib/jquery.min.js"></script>
<script src="static/js/lib/angular.js"></script>
<script src="static/js/lib/vconsole.min.js"></script>
<script src="static//js/server.js"></script>
<script>
    var app = angular.module("app", ['myserver']);
    app.controller('myApp', ['$scope', '$http', '$rootScope', '$q', '$window', 'axios','wxAlert', function ($scope, $http, $rootScope,
                                                                                                  $q, $window, axios,wxAlert) {


        /*title*/
        $scope.title = '附件门店';
        /*门店数据*/
        $scope.shops = [];
        /*监听用户输入*/
        $scope.city = '';
        //根据定位查询门店


        axios.shops().then(function (data) {
            $scope.shops = data.data

        })

        /*搜索*/
        $scope.search = function () {
            console.log($scope.city);
            var v = $scope.city
            if (!v) {
                wxAlert.tooltip('搜索地址不能为空')
                return false
            }
            axios.search(v).then(function (data) {
                $scope.shops = data.data


            })
        }
        /*点击门店获得门店id跳转页面*/
        $scope.wxDepartmentId = function (id) {
            $window.location.href = './nominate.html?wxDepartmentId=' + id + '&isEnd=';

        }
    }])
</script>
</body>

</html>